package se.webbzon.boltzmann.npc;

import javax.vecmath.Point3d;

public abstract class NPCDuty {
	
	// The priority of the duty
	private final int priority;
	
	// The non-player character associated with this duty
	private final AbstractNPC npc;
	
	// The origin of this duty
	private final Point3d origin;
	
	/*============================================================
	Constructors
	============================================================*/
	
	/** Creates a new non-player character duty which will be performed
	 * in a given world area. The duty must be given a priority. **/
	public NPCDuty(int priority, AbstractNPC npc) {
		this.priority = priority;
		this.npc = npc;
		origin = npc.getPosition();
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	/** Returns the priority of the duty. **/
	public int getPriority() {
		return priority;
	}
	
	/** Returns the non-player character associated with this duty. **/
	public AbstractNPC getNPC() {
		return npc;
	}
	
	/** Sets the origin of this duty. **/
	public void setOrigin(double x, double y, double z) {
		origin.set(x, y, z);
	}
	
	/** Copies the origin of this duty to the provided point. **/
	public void getOrigin(Point3d origin) {
		origin.set(this.origin);
	}
	
	/** This method is invoked when a duty for a non-player
	 * character starts. **/
	public abstract void onBegin();
	
	/** This method is invoked in the end of each step for the 
	 * non-player character. **/
	public abstract void onStep();

	/** This method is invoked when a duty for a non-player
	 * character ends. **/
	public abstract void onEnd();
	
}
